package com.qunar.qcf.core.session;

import java.util.Comparator;

import com.qunar.qcf.core.write.WriteRequest;
import com.qunar.qcf.core.write.WriteRequestQueue;

/**
 * Provides data structures to a newly created session.
 * 提供创建session的相关数据
 * 
 */
public interface IoSessionDataStructureFactory {
    /**
     * Returns an {@link IoSessionAttributeMap} which is going to be associated
     * with the specified <tt>session</tt>.  Please note that the returned
     * implementation must be thread-safe.
     */
    IoSessionAttributeMap getAttributeMap(IoSession session) throws Exception;
    
    /**
     * Returns an {@link WriteRequest} which is going to be associated with
     * the specified <tt>session</tt>.  Please note that the returned
     * implementation must be thread-safe and robust enough to deal
     * with various messages types (even what you didn't expect at all),
     * especially when you are going to implement a priority queue which
     * involves {@link Comparator}.
     */
    WriteRequestQueue getWriteRequestQueue(IoSession session) throws Exception;
}
